<?php

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    /**
     * @param int $code
     * @param string $msg
     * @param array|object $data
     * @return false|string
     * @desc 接口返回固定格式，不允许修改
     */
    protected function returnResponse(int $code = 0, string $msg = 'success', $data)
    {
        $msg = [
            "code" => $code,
            "message" => $msg,
            "data" => $data
        ];
        return json_encode($msg);
    }
}
